import logging
import sys

if __name__ == '__main__':
    format = '%(asctime)s - %(funcName)s - %(levelname)s - %(message)s' #生成日期
    date_format = '%Y-%m-%d %H:%M:%S'  #调整时间戳

    logging.basicConfig(
        level=logging.DEBUG, #调整日志级别
        format=format,       #生成时间戳
        datefmt=date_format, #调整时间戳
        filename='day01.log'  #日志保存文件
                        )

    logging.debug('hello world')
    logging.info('hello world')
    logging.warning('hello world')
    logging.error('hello world')
    logging.critical('hello world')
    print('hello world')